$(function() {
	doSearch();
});

function doSearch() {
	var month = $('#month').val();
	var mark = $('#mark').val();
	var groupName = $('#groupName').val();
	
	if (mark != '' &&  groupName !='') {
		showMsg("温馨提示", "Mark和分组不可同时筛选！", alert);
		return false;
	}
	
	var xAxis = [];
	var rate = [];
	var standard = [];
	var div = [];
	var divTotal;
	$.ajax({
		url : '/readerStatistics/listData',
		data : {
			month : month,
			mark : mark,
			groupName : groupName
		},
		type : "POST",
		datatype : "json",
		async : true,
		success : function(data) {
			xAxis = data.xAxis;
			var yAxis = eval(data.yAxis);
			$.each(yAxis, function(index, mod) {
				rate.push(mod.rate);
				standard.push(mod.standard);
				div.push(mod.div);
			});
			$('#divTotal').val(data.divTotal);
			readerStatisticsHandler.showHighChart(xAxis, rate, standard, div);
		}
	});
	
	$('#tt').datagrid('load', {
		month : month,
		mark : mark,
		groupName : groupName
	});
}

function hourFormat(value, row, index){
	return value.substring(11, 13);
}
